<?php
class SiteModel extends MongoModel{
	var $table ='site';
	var $name = '站点';
	
	public static function getSite($site_id=null){
		if($site_id === null){
			$site_id = SITE_ID;
		}
		$key = 'site_' . $site_id;
		$site = Yii::app()->cache->get($key);
		if($site !== false){
			return $site;
		}
		$mod = new SiteModel();
		$site = $mod->get_by_key(SITE_ID);
		if(empty($site)){
			$site = array(
				'_id'	=> SITE_ID,
				'name' => Yii::app()->name,
			);
			$mod->insert($site);
		}
		Yii::app()->cache->set($key, $site);
		return $site;
	}
	
	public static function clean($site_id=null){
		if($site_id === null){
			$site_id = SITE_ID;
		}
		$key = 'site_' . $site_id;
		$site = Yii::app()->cache->delete($key);
	}
	
	public static function getFrontThemeOpts(){
		return array(
			'classic' => '经典'
		);
	}
	
	public static function getManageThemeOpts(){
		return array(
			'default' => '默认'
		);
	}
	
	public static function getMobileThemeOpts(){
		return array(
			'default' => '默认'
		);
	}
}
?>